import * as directorysApi from '../../api/hmmm/directorys'
const directorysInfo = {
  namespaced: true,
  state: {
    directorysList: {},
    directorysSimple: {},
    directorysDetail: {},
    // 根据科目ID获取
    directorysSimpleList: {}
  },
  mutations: {
    SET_DIRECTORYS_LIST: (state, newValue) => {
      state.directorysList = newValue
    },
    SET_DIRECTORYS_SIMPLE: (state, newValue) => {
      state.directorysSimple = newValue
    },
    SET_DIRECTORYS_DETAIL: (state, newValue) => {
      state.directorysDetail = newValue
    },
    SET_DIRECTORYS_SIMPLE_LIST: (state, newValue) => {
      state.directorysSimpleList = newValue
    },

  },
  actions: {
    async updateDirectorysList (context, data) {
      const res = await directorysApi.getDirectoryList(data)
      context.commit('SET_DIRECTORYS_LIST', res)
    },
    async updateDirectorysSimple (context, data) {
      const res = await directorysApi.getDirectorysSimple(data)
      context.commit('SET_DIRECTORYS_SIMPLE', res)
    },
    async updateDirectorysDetail (context, data) {
      const res = await directorysApi.getDirectorysDetail(data)
      context.commit('SET_DIRECTORYS_DETAIL', res)
    },
    async updateDirectorysSimpleList (context, data) {
      const res = await directorysApi.getDirectorysSimpleList(data)
      context.commit('SET_DIRECTORYS_SIMPLE_LIST', res)
    },

  }
}

export default directorysInfo
